<script type="text/javascript">
	function <%= @js_function %>(type)
	{
		if (<% @types.each do |t| if t.is_container %><%= "type.options[type.selectedIndex].value == \"" + t.id.to_s + "\" || " %><% end  end %>false)
		{
			document.getElementById("<%= @visibility_div %>").style.display = "";
		}
		else
		{
			document.getElementById("<%= @visibility_div %>").style.display = "none";
		}
	}
</script>
<%= f.hidden_field(:source_id, :value => @source_id) %>
<%= f.hidden_field(:client_id, :value => @client_id) %>
<div class="edit-table">
	<div class="edit-row">
		<div class="left">
			<%= f.label :item_type_id, "Item Type"%><span class="required">required</span>
			<p>What kind of item is this?</p>
		</div>
		<div class="right">
			<div class="single">
				<%= f.collection_select :item_type_id, @types, :id, :item_type, { :prompt => :true },
							{ :onChange => "javascript:" + @js_function + "(this);" } %>
			</div>
		</div>
	</div>
	<div class="edit-row">
		<div class="left">
			<%= f.label :identifiers, "Identifier" %><span class="optional">(optional)</span>
			<p>Will be auto-generated if blank</p>
		</div>
		<div class="right">
			<div class="single">
				<% f.fields_for :identifiers do |i| %>
					<%= i.text_field :identifier_value %>
					<%= i.hidden_field :identifier_type, :value => 'barcode' %>
				<% end %>
			</div>
		</div>
	</div>
	<div class="edit-row">
		<div class="left">
			<%= f.label :destination_id, 'Send To' %><span class="required">required</span>
			<p>Where the item is going</p>
		</div>
		<div class="right">
			<div class="single">
				<%= f.collection_select(:destination_id, Location.all, :id, :name, :prompt => :true) %>
			</div>
		</div>
	</div>
	<% f.fields_for :item_attribute_values do |iav| %>
		<%#= iav.hidden_field :id, :value => "135138680" %>
	<% end %>
	<%= render :partial => "item_attributes", :collection => @item.item_attribute_values, 
				:locals => {:prefix => "item", :row_class => "edit-row",
							:attribute_map => create_item_attribute_map(ItemAttributeSet.find_all_by_hidden(false))} %>
	<div class="edit-row">
		<div class="left">
			<label>Comments</label><span class="optional">(optional)</span>
			<p>&nbsp;</p>
		</div>
		<div class="right">
			<% f.fields_for :comments do |c| %>
				<%= c.text_area :text %>
				<%= c.hidden_field :user_id, :value => @client_id %>
			<% end %>
		</div>
	</div>
</div>
